package settings.Action;

/**
 * Represents the target of an {@link Action#MOUSEMOVE}.
 * @author BDS
 */
public enum MouseMoveTarget
{
	COORDINATES
	{
		/**
		 * Returns a string specific to the MouseMoveTarget.
		 * @return A string specific to the MouseMoveTarget.
		 */
		@Override
		public String toString()
		{
			return "Coordinates";
		}
	},
	IMAGE
	{
		/**
		 * Returns a string specific to the MouseMoveTarget.
		 * @return A string specific to the MouseMoveTarget.
		 */
		@Override
		public String toString()
		{
			return "Image";
		}
	};

	/**
	 * Generates a MouseMoveTarget from the given name.
	 * @param name The MouseMoveTarget name.
	 * @return The MouseMoveTarget associated with the given MouseMoveTarget name;
	 * {@link MouseMoveTarget#COORDINATES} if not supported.
	 */
	public static MouseMoveTarget fromName(String name)
	{
		if (name != null) 
		{
			for (MouseMoveTarget mouseMoveTarget : MouseMoveTarget.values()) 
			{
				if (name.equalsIgnoreCase(mouseMoveTarget.toString())) 
				{
					return mouseMoveTarget;
				}
			}
		}

		return MouseMoveTarget.COORDINATES;
	}
}
